﻿using GalaSoft.MvvmLight;
using System.Windows;
using WinAutomator.Library.InOut;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using WinAutomator.Library;

namespace WinAutomator.Plugin.BuildIns
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class ControlTestViewModel : PluginViewModel
    {
        private WASetString _model;
        /// <summary>
        /// Initializes a new instance of the ControlTestViewModel class.
        /// </summary>
        public ControlTestViewModel()
        {
            _model = new WASetString();
            ConnectorOut = new WAConnectorViewModel(_model.VOut);
            this.Top = 20;
            this.Left = 100;
        }

        /// <summary>
        /// The <see cref="Message" /> property's name.
        /// </summary>
        public const string MessagePropertyName = "Message";

        /// <summary>
        /// Sets and gets the Message property.
        /// Changes to that property's value raise the PropertyChanged event. 
        /// </summary>
        public string Message
        {
            get
            {
                return ((WASetString)Model).Message;
            }

            set
            {
                if (((WASetString)Model).Message == value)
                {
                    return;
                }

                ((WASetString)Model).Message = value;
                //_model.Message = _message;
                RaisePropertyChanged(MessagePropertyName);
            }
        }

        public WAConnectorViewModel ConnectorOut { get; set; }

        public override IProcess Model
        {
            get { return _model; }
        }
    }
}